<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

	<title>修改密码</title>

	<link href="/static/home/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
	<link href="/static/home/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

	<link href="/static/home/css/personal.css" rel="stylesheet" type="text/css">
	<link href="/static/home/css/stepstyle.css" rel="stylesheet" type="text/css">

	<script type="text/javascript" src="/static/home/js/jquery-1.7.2.min.js"></script>
	<script src="/static/home/AmazeUI-2.4.2/assets/js/amazeui.js"></script>

</head>

<body>
<!--头 -->
<header>
	<article>
		<div class="mt-logo">
			<!--顶部导航条 -->
			<div class="am-container header">
				<!--<ul class="message-l">
					<div class="topMessage">
						<div class="menu-hd">
							<a href="#" target="_top" class="h">亲，请登录</a>
							<a href="#" target="_top">免费注册</a>
						</div>
					</div>
				</ul>-->
				<ul class="message-r">
					<div class="topMessage home">
						<div class="menu-hd"><a href="/index/index/index" target="_top" class="h">商城首页</a></div>
					</div>
					<div class="topMessage my-shangcheng">
						<div class="menu-hd MyShangcheng"><a href="/index/person/index" target="_top"><i
							class="am-icon-user am-icon-fw"></i>个人中心</a></div>
					</div>
					<div class="topMessage mini-cart">
						<div class="menu-hd"><a id="mc-menu-hd" href="/index/person/shopcart" target="_top"><i
							class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum"
																								  class="h"></strong></a>
						</div>
					</div>
					<div class="topMessage favorite">
						<div class="menu-hd"><a href="#" target="_top"><i
							class="am-icon-heart am-icon-fw"></i><span>收藏夹</span></a>
							<a href="/index/index/loginout">退出</a>
						</div>
					</div>
				</ul>
			</div>

			<!--悬浮搜索框-->

			<div class="nav white">
				<div class="logoBig">
					<li><img src="/static/home/images/logobig.png"/></li>
				</div>

				<div class="search-bar pr">
					<a name="index_none_header_sysc" href="#"></a>
					<form>
						<input id="searchInput" name="index_none_header_sysc" type="text" placeholder="搜索"
							   autocomplete="off">
						<input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="submit">
					</form>
				</div>
			</div>

			<div class="clear"></div>
		</div>
		</div>
	</article>
</header>
<b class="line"></b>
<div class="center">
	<div class="col-main">
		<div class="main-wrap">

			<div class="am-cf am-padding">
				<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">修改密码</strong> /
					<small>Password</small>
				</div>
			</div>
			<hr/>
			<!--进度条-->
			<div class="m-progress">
				<div class="m-progress-list">
							<span class="step-1 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">1<em class="bg"></em></i>
                                <p class="stage-name">重置密码</p>
                            </span>
					<span class="step-2 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">2<em class="bg"></em></i>
                                <p class="stage-name">完成</p>
                            </span>
					<span class="u-progress-placeholder"></span>
				</div>
				<div class="u-progress-bar total-steps-2">
					<div class="u-progress-bar-inner"></div>
				</div>
			</div>
			<form class="am-form am-form-horizontal">
				<div class="am-form-group">
					<label for="user-old-password" class="am-form-label">原密码</label>
					<div class="am-form-content">
						<input type="password" id="user-old-password" placeholder="请输入原登录密码">
						<span id="oldTip"></span>
					</div>
				</div>
				<div class="am-form-group">
					<label for="user-new-password" class="am-form-label">新密码</label>
					<div class="am-form-content">
						<input type="password" id="user-new-password" placeholder="输入密码">
						<span id="pwdTip"></span>
					</div>
				</div>
				<div class="am-form-group">
					<label for="user-confirm-password" class="am-form-label">确认密码</label>
					<div class="am-form-content">
						<input type="password" id="user-confirm-password" placeholder="请再次输入上面的密码">
						<span id="finPwdTip"></span>
					</div>
				</div>
				<div class="info-btn">
					<div class="am-btn am-btn-danger" id="pwdSubmit">保存修改</div>
				</div>

			</form>
		</div>


		<script>
            $(function () {
                //获取原密码
                var oldFlag = false;

                var oldPwd = null;
                $('#user-old-password').blur(function () {
                    oldPwd = $('#user-old-password').val();
                    $.post('passwordCheck', {pwd: oldPwd}, success, 'json');
                });
                $('#user-old-password').focus(function () {
                    $('#oldTip').text('');
                    oldFlag = false;
                });

                //新密码验证
                var pwdFlag = false;

                var newPwd = null;
                $('#user-new-password').blur(function () {
                    newPwd = $('#user-new-password').val();
                    if (newPwd.length < 6) {
                        $('#pwdTip').text('密码少于6位').css('color', 'red');
                        pwdFlag = false;
                        return false;
                    }
                    //验证密码是否符合要求
                    if (newPwd == parseInt(newPwd)) {
                        $('#pwdTip').text('密码不能为纯数字').css('color', 'red');
                        pwdFlag = false;
                        return false;
                    }

                    if (newPwd == oldPwd) {
                        $('#pwdTip').text('密码与旧密码相同').css('color', 'red');
                        pwdFlag = false;
                        return false;
                    }

                    $('#pwdTip').text('密码可用').css('color', 'blue');

                    pwdFlag = true;
                });
                $('#user-new-password').focus(function () {
                    $('#pwdTip').text('');
                    pwdFlag = false;
                    $('#finPwdTip').text('');
                });

                //重复密码
                var newFlag = false;

                $('#user-confirm-password').blur(function () {
                    var finPwd = $('#user-confirm-password').val();
                    if (newPwd == finPwd && finPwd != '') {
                        $('#finPwdTip').text('密码正确').css('color', 'blue');
                        newFlag = true;
                    } else {
                        $('#finPwdTip').text('密码不一致').css('color', 'red');
                        newFlag = false;
                    }
                });
                $('#user-confirm-password').focus(function () {
                    $('#finPwdTip').text('');
                });

                //ajax提交修改密码
                $('#pwdSubmit').mousedown(function () {
                    setTimeout(function () {
                        if (oldFlag && newFlag && pwdFlag) {
                            $.post('/index/person/modify', {pwd: newPwd}, success, 'json');
                        } else {
                            alert('请检查输入信息');
                        }
                    }, 600);

                });


                function success(data) {
                    switch (data.value) {
                        case 1:
                            $('#oldTip').text('原密码正确').css('color', 'blue');
                            oldFlag = true;
                            break;
                        case 2:
                            oldFlag = false;
                            $('#oldTip').text('原密码有误').css('color', 'red');
                            break;
                        case 3:
                            pwdFlag = false;
                            alert('修改密码成功');
                            break;
                        case 4:
                            pwdFlag = false;
                            alert('修改失败');
                            break;

                    }

                }

            });

		</script>

		<!--底部-->
		<div class="footer">
			<div class="footer-hd">
				<p>
					<a href="#">恒望科技</a>
					<b>|</b>
					<a href="/index/index/index">商城首页</a>
					<b>|</b>
					<a href="#">支付宝</a>
					<b>|</b>
					<a href="#">物流</a>
				</p>
			</div>
			<div class="footer-bd">
				<p>
					<a href="#">关于恒望</a>
					<a href="#">合作伙伴</a>
					<a href="#">联系我们</a>
					<a href="#">网站地图</a>
					<em>© 2015-2025 Hengwang.com 版权所有</em>
				</p>
			</div>
		</div>
	</div>

	<aside class="menu">
		<ul>
			<li class="person active">
				<a href="/index/person/index"><i class="am-icon-user"></i>个人中心</a>
			</li>
			<li class="person">
				<p><i class="am-icon-newspaper-o"></i>个人资料</p>
				<ul>
					<li><a href="/index/person/information">个人信息</a></li>
					<li><a href="/index/person/password">安全设置</a></li>
					<li><a href="/index/person/address">地址管理</a></li>
					<li><a href="#">快捷支付</a></li>
				</ul>
			</li>
			<li class="person">
				<p><i class="am-icon-balance-scale"></i>我的交易</p>
				<ul>
					<li><a href="/index/person/order">订单管理</a></li>
					<li><a href="#">退款售后</a></li>
					<li><a href="#">评价商品</a></li>
				</ul>
			</li>
			<li class="person">
				<p><i class="am-icon-dollar"></i>我的资产</p>
				<ul>
					<li><a href="#">我的积分</a></li>
					<li><a href="#">优惠券 </a></li>
					<li><a href="#">红包</a></li>
					<li><a href="#">账户余额</a></li>
					<li><a href="#">账单明细</a></li>
				</ul>
			</li>

			<li class="person">
				<p><i class="am-icon-tags"></i>我的收藏</p>
				<ul>
					<li><a href="#">收藏</a></li>
					<li><a href="#">足迹</a></li>
				</ul>
			</li>

			<li class="person">
				<p><i class="am-icon-qq"></i>在线客服</p>
				<ul>
					<li><a href="#">商品咨询</a></li>
					<li><a href="#">意见反馈</a></li>

					<li><a href="#">我的消息</a></li>
				</ul>
			</li>
		</ul>

	</aside>
</div>

</body>

</html>